<template>
  <codemirror
    placeholder="请输入Yaml格式数据"
    v-model="code"
    ref="myCodemirror"
    :autofocus="true"
    :extensions="extensions"
    :indent-with-tab="true"
    :tab-size="2"
    @change="handleChange"
  ></codemirror>
</template>
<script setup>
import { ref } from 'vue'
import { Codemirror } from 'vue-codemirror'
import { yaml } from '@codemirror/lang-yaml'

const emits = defineEmits(['update:modelValue', 'update:textVal'])

const myCodemirror = ref(null)

const code = ref('')
const extensions = [yaml()]
const handleChange = (value) => {
  console.log(value)
  code.value = value
  emits('update:modelValue', code.value)
  // emits('update:textVal', value)
}
</script>
